package com.devperson.callable.runnableResult;

import java.util.Date;

/**
 * 功能描述:
 *
 * @author lixiaomeng
 * @date 2018/12/4
 */
public class RunMyResultObject implements Runnable {

    private ResultObject resultObject;

    public RunMyResultObject(ResultObject resultObject) {
        this.resultObject = resultObject;
    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
        System.out.println(resultObject.toString());
        resultObject.setCode(1);
        System.out.println("这是传入的内容："+ resultObject.getResult());
        resultObject.setResult("这是返回的结果");
        resultObject.setDate(new Date());
    }
}
